package com.hb.core.oauth2;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;

/**
 * @description: 配置jwtToken转换器
 * @projectName: zhb-frame-build
 * @author: zhouhaizhi
 * @createTime: 2021/8/30 10:42
 * @version:1.0
 */
@Configuration
public class JwtAccessTokenConverterConfig {

    @Value("${oauth2.jwt-secret}")
    public String jwtSecret;

    @Bean
    public JwtAccessTokenConverter jwtAccessTokenConverter(){
        JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
        // 配置对称密钥
        converter.setSigningKey(jwtSecret);
        return converter;
    }
}
